package co.baiku.boot.live.baijiayun.request;

import co.baiku.boot.config.BaijiaLiveConfig;
import co.baiku.boot.live.baijiayun.util.BaiJiaSignUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 百家云基础参数
 */
public abstract class BaiJiaLiveRequest {

    public Map<String, Object> toMap(BaijiaLiveConfig config) {
        Map<String, Object> map = new HashMap<>(16);
        map.put("partner_id", config.getPartner_id());
        map.put("timestamp", System.currentTimeMillis() / 1000);
        map.putAll(buildMap());
        map.put("sign", BaiJiaSignUtil.buildSign(map, config.getPartner_key()));
        return map;
    }


    protected abstract Map<String, Object> buildMap();


}
